# list 列表，数组
classmates = ['chuchu', 'leo', 'abc']
print(classmates)
count = len(classmates)
print(count)
print("the len is %d" % len(classmates))
print(classmates[0])
print(classmates[1])
print(classmates[2])

for name in classmates:
    print(name)

print(classmates[-1])  # 用-1取最后一个元素
print(classmates[-2])  # 用-2取倒数第二个元素
print(classmates[-3])

classmates.append('zhuyao')  # 追加元素到列表最后用append
print(classmates[-1])

classmates.insert(2, 'guixiang')  # 插入元素到指定位置 用insert
print(classmates)

classmates.remove('chuchu')
print(classmates)

classmates.pop(-1)
print(classmates)

classmates.append('abc')

print(classmates.count('abc'))  # 列表中某个元素的总个数

classmates[-1] = 'yagnxinting'
print(classmates)

list = ['name', 'sddd', [1, 2, 3], '3434f']
print(list)

list = [True, 'ABC', 1000]  # 列表中的元素可以不同的类型。很自由
print(list)



